// src/types/iframe.ts

// 消息类型枚举
export enum MessageType {
  PARENT_MESSAGE = 'PARENT_MESSAGE',
  CHILD_MESSAGE = 'CHILD_MESSAGE',
  SET_THEME = 'SET_THEME',
  REQUEST_HELP = 'REQUEST_HELP',
  INIT = 'INIT',
  CHILD_LOADED = 'CHILD_LOADED',
  CALL_FUNCTION = 'CALL_FUNCTION',
  FUNCTION_RESULT = 'FUNCTION_RESULT',
  CHILD_SDK_LOADED = 'CHILD_SDK_LOADED'
}

// 主题颜色类型
export type ThemeColor = 'gray' | 'blue' | 'green' | 'red' | 'purple' | string

// 通信状态
export interface ConnectionState {
  isConnected: boolean
  lastMessageTime: Date | null
  messageCount: number
  activeTheme: ThemeColor
}

// 框架消息结构
export interface FrameMessage<T = any> {
  type: MessageType
  payload: T
}